from mcp.server.fastmcp import FastMCP

from bilibili_api import search, sync

mcp = FastMCP("Bilibili MCP Server")

@mcp.tool()
def general_search(keyword: str) -> dict:
    """
    Search Bilibili API with the given keyword

    Args:
        keyword (str): Search term to look for on Bilibili
    Returns:
        Dictionary containing the search results from Bilibili
    """

    result = sync(search.search(keyword))
    return result

if __name__ == "__main__":
    mcp.run(transport="stdio")